<%@page import="com.student.util.GetExistDays"%>
<%@page import="com.student.service.studentService"%>
<%@page import="com.student.entity.Student"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>个人信息页</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script type="text/javascript" src="js/jquery.min.js" async></script>
<script type="text/javascript" src="js/bootstrap.min.js" async></script>
<style type="text/css">
	span.value{color: blue;}
	table tr td:nth-child(odd){font-weight: bold;}
</style>
</head>

<body>
<%
String user=(String) session.getAttribute("user");

if(user!=null){
	studentService service = new studentService();
	Student student = service.getInfo(user);
	String registerTime = service.getRegisterTime(new Student(user));
	int existTime = new GetExistDays().getExistTime(registerTime);
	
	request.setAttribute("student", student);
	request.setAttribute("existTime", existTime);
	request.setAttribute("registerTime", registerTime);
	
	%>
	<div class="container">
	<div class="row clearfix">
		<div class="col-md-12 column">
			<ul class="breadcrumb">
				<li><a href="#">欢迎你：<span></span></a></li>
				<li class="active">${student.getUname()}</li>
			</ul>
			<table class="table table-hover table-condensed table-bordered">
				<thead>
					<tr class="success"><th colspan="4">用户信息页</th></tr>
				</thead>
				<tbody>
					<tr>
						<td>工号/学号</td><td colspan="2">${student.getId()}</td><td rowspan="3"><img src="img/userPic.png" style="width: 15%;height: auto;"></td>
					</tr>
					<tr class="info">
						<td>用户名</td><td colspan="2">${student.getUname()}</td>
					</tr>
					<tr>
						<td>部门/院系</td><td colspan="2">${student.getDepart() }</td>
					</tr>
					
					<tr>
						<td>身份</td><td>${student.getType()==1? "管理员":"学生" }</td><td>是否有效</td><td>**</td>
					</tr>
					
					<tr class="info">
						<td>入校时间</td><td>${registerTime }</td><td>在校时间</td><td>${requestScope.existTime }天</td>
					</tr>
					<tr>
						<td>用户类别</td><td>管理员</td><td>工龄/学制</td><td>5</td>
					</tr>
					<tr class="info">
						<td>上次登录时间</td><td>${student.getLoginTime() }</td><td>登录地址</td><td><%=request.getRemoteAddr() %></td>
					</tr>

				</tbody>
			</table>
		</div>
	</div>
</div>

	<%
	}else{
		response.sendRedirect("error/needLogin.html");
	}
%>


</body>
</html>